// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyavtSimulationCommandSpecification.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyavtSimulationCommandSpecification
//
// Purpose:
//   Contains the specification for one command
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a avtSimulationCommandSpecification.
//
struct avtSimulationCommandSpecificationObject
{
    PyObject_HEAD
    avtSimulationCommandSpecification *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewavtSimulationCommandSpecification(int);
std::string
PyavtSimulationCommandSpecification_ToString(const avtSimulationCommandSpecification *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    snprintf(tmpStr, 1000, "%sname = \"%s\"\n", prefix, atts->GetName().c_str());
    str += tmpStr;
    const char *argumentType_names = "CmdArgNone, CmdArgInt, CmdArgFloat, CmdArgString";
    switch (atts->GetArgumentType())
    {
      case avtSimulationCommandSpecification::CmdArgNone:
          snprintf(tmpStr, 1000, "%sargumentType = %sCmdArgNone  # %s\n", prefix, prefix, argumentType_names);
          str += tmpStr;
          break;
      case avtSimulationCommandSpecification::CmdArgInt:
          snprintf(tmpStr, 1000, "%sargumentType = %sCmdArgInt  # %s\n", prefix, prefix, argumentType_names);
          str += tmpStr;
          break;
      case avtSimulationCommandSpecification::CmdArgFloat:
          snprintf(tmpStr, 1000, "%sargumentType = %sCmdArgFloat  # %s\n", prefix, prefix, argumentType_names);
          str += tmpStr;
          break;
      case avtSimulationCommandSpecification::CmdArgString:
          snprintf(tmpStr, 1000, "%sargumentType = %sCmdArgString  # %s\n", prefix, prefix, argumentType_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    snprintf(tmpStr, 1000, "%sclassName = \"%s\"\n", prefix, atts->GetClassName().c_str());
    str += tmpStr;
    if(atts->GetEnabled())
        snprintf(tmpStr, 1000, "%senabled = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%senabled = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sparent = \"%s\"\n", prefix, atts->GetParent().c_str());
    str += tmpStr;
    if(atts->GetIsOn())
        snprintf(tmpStr, 1000, "%sisOn = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sisOn = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%ssignal = \"%s\"\n", prefix, atts->GetSignal().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stext = \"%s\"\n", prefix, atts->GetText().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%suiType = \"%s\"\n", prefix, atts->GetUiType().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%svalue = \"%s\"\n", prefix, atts->GetValue().c_str());
    str += tmpStr;
    return str;
}

static PyObject *
avtSimulationCommandSpecification_Notify(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetName(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the name in the object.
    obj->data->SetName(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetName(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetName().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetArgumentType(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 4)
    {
        std::stringstream ss;
        ss << "An invalid argumentType value was given." << std::endl;
        ss << "Valid values are in the range [0,3]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " CmdArgNone";
        ss << ", CmdArgInt";
        ss << ", CmdArgFloat";
        ss << ", CmdArgString";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the argumentType in the object.
    obj->data->SetArgumentType(avtSimulationCommandSpecification::CommandArgumentType(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetArgumentType(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetArgumentType()));
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetClassName(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the className in the object.
    obj->data->SetClassName(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetClassName(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetClassName().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetEnabled(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the enabled in the object.
    obj->data->SetEnabled(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetEnabled(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetEnabled()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetParent(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the parent in the object.
    obj->data->SetParent(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetParent(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetParent().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetIsOn(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the isOn in the object.
    obj->data->SetIsOn(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetIsOn(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetIsOn()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetSignal(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the signal in the object.
    obj->data->SetSignal(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetSignal(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetSignal().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetText(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the text in the object.
    obj->data->SetText(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetText(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetText().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetUiType(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the uiType in the object.
    obj->data->SetUiType(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetUiType(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetUiType().c_str());
    return retval;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_SetValue(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the value in the object.
    obj->data->SetValue(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtSimulationCommandSpecification_GetValue(PyObject *self, PyObject *args)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetValue().c_str());
    return retval;
}



PyMethodDef PyavtSimulationCommandSpecification_methods[AVTSIMULATIONCOMMANDSPECIFICATION_NMETH] = {
    {"Notify", avtSimulationCommandSpecification_Notify, METH_VARARGS},
    {"SetName", avtSimulationCommandSpecification_SetName, METH_VARARGS},
    {"GetName", avtSimulationCommandSpecification_GetName, METH_VARARGS},
    {"SetArgumentType", avtSimulationCommandSpecification_SetArgumentType, METH_VARARGS},
    {"GetArgumentType", avtSimulationCommandSpecification_GetArgumentType, METH_VARARGS},
    {"SetClassName", avtSimulationCommandSpecification_SetClassName, METH_VARARGS},
    {"GetClassName", avtSimulationCommandSpecification_GetClassName, METH_VARARGS},
    {"SetEnabled", avtSimulationCommandSpecification_SetEnabled, METH_VARARGS},
    {"GetEnabled", avtSimulationCommandSpecification_GetEnabled, METH_VARARGS},
    {"SetParent", avtSimulationCommandSpecification_SetParent, METH_VARARGS},
    {"GetParent", avtSimulationCommandSpecification_GetParent, METH_VARARGS},
    {"SetIsOn", avtSimulationCommandSpecification_SetIsOn, METH_VARARGS},
    {"GetIsOn", avtSimulationCommandSpecification_GetIsOn, METH_VARARGS},
    {"SetSignal", avtSimulationCommandSpecification_SetSignal, METH_VARARGS},
    {"GetSignal", avtSimulationCommandSpecification_GetSignal, METH_VARARGS},
    {"SetText", avtSimulationCommandSpecification_SetText, METH_VARARGS},
    {"GetText", avtSimulationCommandSpecification_GetText, METH_VARARGS},
    {"SetUiType", avtSimulationCommandSpecification_SetUiType, METH_VARARGS},
    {"GetUiType", avtSimulationCommandSpecification_GetUiType, METH_VARARGS},
    {"SetValue", avtSimulationCommandSpecification_SetValue, METH_VARARGS},
    {"GetValue", avtSimulationCommandSpecification_GetValue, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
avtSimulationCommandSpecification_dealloc(PyObject *v)
{
   avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *avtSimulationCommandSpecification_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyavtSimulationCommandSpecification_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "name") == 0)
        return avtSimulationCommandSpecification_GetName(self, NULL);
    if(strcmp(name, "argumentType") == 0)
        return avtSimulationCommandSpecification_GetArgumentType(self, NULL);
    if(strcmp(name, "CmdArgNone") == 0)
        return PyInt_FromLong(long(avtSimulationCommandSpecification::CmdArgNone));
    if(strcmp(name, "CmdArgInt") == 0)
        return PyInt_FromLong(long(avtSimulationCommandSpecification::CmdArgInt));
    if(strcmp(name, "CmdArgFloat") == 0)
        return PyInt_FromLong(long(avtSimulationCommandSpecification::CmdArgFloat));
    if(strcmp(name, "CmdArgString") == 0)
        return PyInt_FromLong(long(avtSimulationCommandSpecification::CmdArgString));

    if(strcmp(name, "className") == 0)
        return avtSimulationCommandSpecification_GetClassName(self, NULL);
    if(strcmp(name, "enabled") == 0)
        return avtSimulationCommandSpecification_GetEnabled(self, NULL);
    if(strcmp(name, "parent") == 0)
        return avtSimulationCommandSpecification_GetParent(self, NULL);
    if(strcmp(name, "isOn") == 0)
        return avtSimulationCommandSpecification_GetIsOn(self, NULL);
    if(strcmp(name, "signal") == 0)
        return avtSimulationCommandSpecification_GetSignal(self, NULL);
    if(strcmp(name, "text") == 0)
        return avtSimulationCommandSpecification_GetText(self, NULL);
    if(strcmp(name, "uiType") == 0)
        return avtSimulationCommandSpecification_GetUiType(self, NULL);
    if(strcmp(name, "value") == 0)
        return avtSimulationCommandSpecification_GetValue(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyavtSimulationCommandSpecification_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyavtSimulationCommandSpecification_methods[i].ml_name),
                PyString_FromString(PyavtSimulationCommandSpecification_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyavtSimulationCommandSpecification_methods, self, name);
}

int
PyavtSimulationCommandSpecification_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "name") == 0)
        obj = avtSimulationCommandSpecification_SetName(self, args);
    else if(strcmp(name, "argumentType") == 0)
        obj = avtSimulationCommandSpecification_SetArgumentType(self, args);
    else if(strcmp(name, "className") == 0)
        obj = avtSimulationCommandSpecification_SetClassName(self, args);
    else if(strcmp(name, "enabled") == 0)
        obj = avtSimulationCommandSpecification_SetEnabled(self, args);
    else if(strcmp(name, "parent") == 0)
        obj = avtSimulationCommandSpecification_SetParent(self, args);
    else if(strcmp(name, "isOn") == 0)
        obj = avtSimulationCommandSpecification_SetIsOn(self, args);
    else if(strcmp(name, "signal") == 0)
        obj = avtSimulationCommandSpecification_SetSignal(self, args);
    else if(strcmp(name, "text") == 0)
        obj = avtSimulationCommandSpecification_SetText(self, args);
    else if(strcmp(name, "uiType") == 0)
        obj = avtSimulationCommandSpecification_SetUiType(self, args);
    else if(strcmp(name, "value") == 0)
        obj = avtSimulationCommandSpecification_SetValue(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
avtSimulationCommandSpecification_print(PyObject *v, FILE *fp, int flags)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)v;
    fprintf(fp, "%s", PyavtSimulationCommandSpecification_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
avtSimulationCommandSpecification_str(PyObject *v)
{
    avtSimulationCommandSpecificationObject *obj = (avtSimulationCommandSpecificationObject *)v;
    return PyString_FromString(PyavtSimulationCommandSpecification_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *avtSimulationCommandSpecification_Purpose = "Contains the specification for one command";
#else
static char *avtSimulationCommandSpecification_Purpose = "Contains the specification for one command";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(avtSimulationCommandSpecificationType,         \
                  "avtSimulationCommandSpecification",           \
                  avtSimulationCommandSpecificationObject,       \
                  avtSimulationCommandSpecification_dealloc,     \
                  avtSimulationCommandSpecification_print,       \
                  PyavtSimulationCommandSpecification_getattr,   \
                  PyavtSimulationCommandSpecification_setattr,   \
                  avtSimulationCommandSpecification_str,         \
                  avtSimulationCommandSpecification_Purpose,     \
                  avtSimulationCommandSpecification_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
avtSimulationCommandSpecification_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &avtSimulationCommandSpecificationType
         || Py_TYPE(other) != &avtSimulationCommandSpecificationType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    avtSimulationCommandSpecification *a = ((avtSimulationCommandSpecificationObject *)self)->data;
    avtSimulationCommandSpecification *b = ((avtSimulationCommandSpecificationObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static avtSimulationCommandSpecification *defaultAtts = 0;
static avtSimulationCommandSpecification *currentAtts = 0;

static PyObject *
NewavtSimulationCommandSpecification(int useCurrent)
{
    avtSimulationCommandSpecificationObject *newObject;
    newObject = PyObject_NEW(avtSimulationCommandSpecificationObject, &avtSimulationCommandSpecificationType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new avtSimulationCommandSpecification(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new avtSimulationCommandSpecification(*defaultAtts);
    else
        newObject->data = new avtSimulationCommandSpecification;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapavtSimulationCommandSpecification(const avtSimulationCommandSpecification *attr)
{
    avtSimulationCommandSpecificationObject *newObject;
    newObject = PyObject_NEW(avtSimulationCommandSpecificationObject, &avtSimulationCommandSpecificationType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (avtSimulationCommandSpecification *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
avtSimulationCommandSpecification_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewavtSimulationCommandSpecification(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef avtSimulationCommandSpecificationMethods[] = {
    {"avtSimulationCommandSpecification", avtSimulationCommandSpecification_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *avtSimulationCommandSpecificationObserver = 0;

std::string
PyavtSimulationCommandSpecification_GetLogString()
{
    std::string s("avtSimulationCommandSpecification = avtSimulationCommandSpecification()\n");
    if(currentAtts != 0)
        s += PyavtSimulationCommandSpecification_ToString(currentAtts, "avtSimulationCommandSpecification.", true);
    return s;
}

static void
PyavtSimulationCommandSpecification_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("avtSimulationCommandSpecification = avtSimulationCommandSpecification()\n");
        s += PyavtSimulationCommandSpecification_ToString(currentAtts, "avtSimulationCommandSpecification.", true);
        cb(s);
    }
}

void
PyavtSimulationCommandSpecification_StartUp(avtSimulationCommandSpecification *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyavtSimulationCommandSpecification_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(avtSimulationCommandSpecificationObserver == 0)
    {
        avtSimulationCommandSpecificationObserver = new ObserverToCallback(subj,
            PyavtSimulationCommandSpecification_CallLogRoutine, (void *)data);
    }

}

void
PyavtSimulationCommandSpecification_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete avtSimulationCommandSpecificationObserver;
    avtSimulationCommandSpecificationObserver = 0;
}

PyMethodDef *
PyavtSimulationCommandSpecification_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return avtSimulationCommandSpecificationMethods;
}

bool
PyavtSimulationCommandSpecification_Check(PyObject *obj)
{
    return (obj->ob_type == &avtSimulationCommandSpecificationType);
}

avtSimulationCommandSpecification *
PyavtSimulationCommandSpecification_FromPyObject(PyObject *obj)
{
    avtSimulationCommandSpecificationObject *obj2 = (avtSimulationCommandSpecificationObject *)obj;
    return obj2->data;
}

PyObject *
PyavtSimulationCommandSpecification_New()
{
    return NewavtSimulationCommandSpecification(0);
}

PyObject *
PyavtSimulationCommandSpecification_Wrap(const avtSimulationCommandSpecification *attr)
{
    return WrapavtSimulationCommandSpecification(attr);
}

void
PyavtSimulationCommandSpecification_SetParent(PyObject *obj, PyObject *parent)
{
    avtSimulationCommandSpecificationObject *obj2 = (avtSimulationCommandSpecificationObject *)obj;
    obj2->parent = parent;
}

void
PyavtSimulationCommandSpecification_SetDefaults(const avtSimulationCommandSpecification *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new avtSimulationCommandSpecification(*atts);
}

